 

	      var sel;
	      var likeOp;
	      var noLikeOp;
		   function ajaxSubmitOK(){
		     syncSolutionList();
		   }
		   
		   function formatField(v,metadata,record,rowIndex,colIndex)
		   {
		      var fvalue = record.get('filterField');
		      if(fvalue==null) return;
		      if(v==null || v=="")      return;
		      var field = getFieldType(fvalue);
		      if(field)
		      {
		           var fieldtype = field.charAt(0);
	   			if(fieldtype == '0')
	   			{
				       return v;
				} else if(fieldtype == '1')
				{
				     var r = findRecord(fvalue,v);
				     return r.text;
				}
				else if(fieldtype == '2')
				{
					var d = new Date(Date.parse(v));
					if(d=='Invalid Date' || d=='NaN')
					           return v.substring(0,10);
					return d.format("Y-m-d");
				}
				else if(fieldtype == '3')
				{
				    var r = findf7Record(fvalue,v);
				   // var rec=Ext.data.Record.create(['value', 'text']);
				  //  var d = { text:r.text ,value: v };
				 //   hiddenCombo.initialConfig.store.add(new rec(d));
				    return r ;
				}
		       return v;
		    }    
		    return v;  
	       }
		   
	       function	 findf7Record(fvalue,prop) {
		       var record;
	           // if (F7FieldEditor.store.getCount() == 0) 
		       F7FieldEditor = reloadF7Value(prop);
		    if (F7FieldEditor.store.getCount() > 0) {
			F7FieldEditor.store.each(function(r) {
					if(this.get('value')==prop){
						record = r;
					 }
			});
		   }
		   if(record)
		   {
		   	if(record.data.text.name)
		   	  return record.data.text.name;
		   	else
		   	  return record.data.text[0].text.name;
		   }
		   else
		   	return prop;
	      }
	      
	      function findRecord(fvalue,prop) {
		       var record;
		        if (comboFieldEditor.store.getCount() == 0) 
		              comboFieldEditor = constructComboFieldEditor(fvalue);
		        if (comboFieldEditor.store.getCount() > 0) {
			   comboFieldEditor.store.each(function(r) {
					if(this.get('value')==prop){
						record = r;
					 }
			});
		   }
		   if(record)
		   	return record.data;
		   else
		   	return prop;
	         }
	         
	         function mycompareSelector(r)
	         {
	             var fvalue = r.get('filterField');
		   if(fvalue==null) return compareOpEditor;
		   var field = getFieldType(fvalue);
		   if(field)
		   {
		        var fieldtype = field.charAt(0);
		        if(fieldtype == '1' || fieldtype == '2')
		        {
 		            var opLike = compareOpEditor.store.getAt(2);
 		            var opNoLike = compareOpEditor.store.getAt(3);
 		            if(opLike.data.value=='like')
 		            {
 		              likeOp = opLike;
 		              noLikeOp = opNoLike;
 		              compareOpEditor.store.remove(opLike);
		              compareOpEditor.store.remove(opNoLike);
 		            }  
		        }
		        else
		        {
				if(compareOpEditor.store!=null)
				{
			     		var opLike = compareOpEditor.store.getAt(2);
			      		if(opLike.data.value!='like')
			      		{
			         	compareOpEditor.store.insert(2,likeOp);
			        	 compareOpEditor.store.insert(3,noLikeOp);
			     		}	
			     }
		        }
		   }
	          else
		  {
		  	if(compareOpEditor.store!=null)
		  	{
			      var opLike = compareOpEditor.store.getAt(2);
			      if(opLike.data.value!='like')
			      {
			         compareOpEditor.store.insert(2,likeOp);
			         compareOpEditor.store.insert(3,noLikeOp);
			      }
			 }
		   }
	         
	             return compareOpEditor;
	         }
	         
		   function myEditorSelector(r){
		   var fvalue = r.get('filterField');
		   if(fvalue==null) return textFieldEditor;
		   var field = getFieldType(fvalue);
		   if(field)
		   {
		        var fieldtype = field.charAt(0);
	   		if(fieldtype == '1')
			{
			    return constructComboFieldEditor(fvalue);
			}
			else if(fieldtype == '2')
			{
			    return dateFieldEditor;
			}
			else if(fieldtype == '3')
			{
			     reloadF7Query(fvalue);
			     return F7FieldEditor;
			}
			 return textFieldEditor;
	   	    }
	   		else
	   		   return textFieldEditor;
		   }
		   
		   function reloadF7Query(queryField)
		   {	
		   		var totalCount = hiddenCombo.initialConfig.store.getTotalCount();
				for(var i=0;i<totalCount;i++){
					var record = hiddenCombo.initialConfig.store.getAt(i);
					var searchPrefix = queryField;
					if(record.get('value').indexOf(searchPrefix)>-1){
						 var queryValue = record.get('text').split(',');
						 Ext.apply(F7FieldEditor,{queryInfo:queryValue[1],diaplayFormat:queryValue[2],editFormat:queryValue[3],commitFormat:queryValue[4]} );
						 break;
					} 
				}
		   }
		   
		   function reloadF7Value(queryValue)
		   {	
		   		var totalCount = hiddenCombo.initialConfig.store.getTotalCount();
				for(var i=totalCount-1;i>=0;i--){
					var record = hiddenCombo.initialConfig.store.getAt(i);
					var searchPrefix = queryValue;
					if(record.get('value')==searchPrefix){
						 var queryText = record.get('text');
						 queryText = Ext.decode(queryText);
						 var rec=Ext.data.Record.create(['value', 'text']);
				                 var d = { text:queryText ,value: queryValue };
				                 F7FieldEditor.store.add(new rec(d));
						 break;
					} 
				}
				return F7FieldEditor;
		   }
		   
		   function getFieldType(queryField)
		   {	
		        var totalCount = hiddenCombo.initialConfig.store.getTotalCount();
			for(var i=0;i<totalCount;i++){
			      var record = hiddenCombo.initialConfig.store.getAt(i);
			      var searchPrefix = queryField;
			      if(record.get('value')==searchPrefix){
						 var queryValue = record.get('text');
						 return queryValue;
					} 
				}
		   }
		   
		  function constructComboFieldEditor(field1){
			    comboFieldEditor.bindStore(comboFieldEditor.store,true);
				comboFieldEditor.store.removeAll();
				var comboRecord = Ext.data.Record.create([
    				{name: 'text', mapping: 'text'},
    				{name: 'value', mapping: 'value'}
				]);
				hiddenCombo.initialConfig.store.each(function(){
					var searchPrefix = field1;
					if(this.get('value').indexOf(searchPrefix)>-1){
						var filterValue = this.get('text').split(';');
						comboFieldEditor.store.add(new comboRecord({
							text:filterValue[1],
							value:filterValue[2]
						}));
					} 
				});
			
				return comboFieldEditor;
			}
			
		   function spanMoveIn(e){
		   	  e=e?e:window.event;
          var elm=e.target || e.srcElement;
          if (elm!=null)
		   	  elm.className='spanCss spanSel';
		   }
		   function spanMoveOut(e){
		   	 e=e?e:window.event;
         var elm=e.target || e.srcElement;
         if (elm!=null)
		   	 elm.className='spanCss';
		   }
		   function spanSelect(e){
		   	 e=e?e:window.event;
         var elm=e.target || e.srcElement;
         if (sel!=null)
		   	 sel.className='spanCss';
		   	 elm.className='spanCss spanSel';
		   	 sel=elm;
		   }
		   
		   function spandbClick(e){
		   	  e=e?e:window.event;
          var elm=e.target || e.srcElement;
		   	  var el = document.getElementById('queryDialog:selectSolutionList');
           //if (el) el = el.firstChild;
          if (el && el.options) {
              var opts = el.options;
              for (var i = 0; i < opts.length; i++) {
                if (elm.name==opts[i].value){
                   opts[i].selected = true;
                }
              }  
          }
          sel=elm;
          init();
          OM.ajax.submit('queryDialog',null,null);
		   }
		   
		   function syncSolutionList(){
		   	   var dom= document.getElementById('listContainer');
		       //dom.remow
		       
		        var n = dom.firstChild;
 	          while(n){
 	            var nx = n.nextSibling;
 	            dom.removeChild(n);
 	            n = nx;
 	          }
		       
		       
		       var el = document.getElementById('queryDialog:selectSolutionList');
           //if (el) el = el.firstChild;
           if (el && el.options) {
              var opts = el.options;
              for (var i = 0; i < opts.length; i++) {                 
                  var span = document.createElement('span');
                  span.name=opts[i].value;
                  if (opts[i].selected){
                    span.className='spanCss spanSel';
                    sel=span;
                  } else { span.className='spanCss';}
                  span.innerHTML=opts[i].innerHTML;
                  dom.appendChild(span);
                 //span.onmousemove=spanMoveIn;
                  span.onclick=spandbClick;
                  span.ondblclick=spandbClick;
                //  span.onmouseout=spanMoveOut;
              }
          }
		       
		   }